<?php 

class Item extends CI_Controller {

   public $post_data;
 
	function index()
	{ 
		$user_id  = $this->session->userdata('user_id');
		echo 'User Profile';
		$query = $this->db->get_where('items',array('user_id'=>$user_id));
		if($query->num_rows()) {
			$data['items'][] = $query->result();

			
		}
		$this->load->view('item/list',$data);
    }
        
    function create()
    {
	    $this->load->view('item/create');
	}
	
	function save()
	{
		$this->post_data = $_POST;
		$data = array(
				'id' => uniqid('10_',true),
				'user_id' => $this->post_data['id'],
				'name' => $this->post_data['name']
					 );
		$this->db->insert('items', $data);
		var_dump($_POST);
	}
}
